package com.itheima.controller;

import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.service.ReportService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @version 1.0
 * @description 说明
 * @package com.itheima.controller
 */
@RestController
@Slf4j
@RequestMapping("/report")
@AllArgsConstructor
public class ReportController {

    private ReportService reportService;

    /**
     * 员工职位统计
     * @return
     */
    @GetMapping("empJobData")
    public Result getEmpJobData(){
        JobOption jobOption = reportService.getEmpJobData();
        return Result.success(jobOption);
    }

    /**
     * 按员工性别统计数量
     * @return
     */
    @GetMapping("empGenderData")
    public Result getEmpGenderData(){
        List<Map<String,Object>> dataList = reportService.getEmpGenderData();
        return Result.success(dataList);
    }

    @GetMapping("/studentCountData")
    public Result studentCountData(){
        return Result.success(reportService.studentCountData());
    }

    @GetMapping("/studentDegreeData")
    public Result studentDegreeData(){
        List<Map<String,Object>> list = reportService.studentDegreeData();
        return Result.success(list);
    }
}
